package mshop.com.schild_kotlin.dialogs

import android.content.Context
import android.content.DialogInterface
import android.support.v7.app.AlertDialog

/**
 * Created by mayi on 2018/5/29.
 * @Autor CaiWF
 * @Email 401885064@qq.com
 * @TODO
 */
open class TipsDialog(context: Context) : AlertDialog(context) {
    var builder:AlertDialog.Builder?=null

    init {
        builder=AlertDialog.Builder(context)
    }

    fun setTitle(title:String):TipsDialog{
        builder?.setTitle(title)
        return this
    }

    fun setMessage(title:String):TipsDialog{
        builder?.setMessage(title)
        return this
    }

    fun setPositiveButton(txt:String,listener:DialogInterface.OnClickListener):TipsDialog{
        builder?.setPositiveButton(txt,listener)
        return this
    }

    fun setNegativeButton(txt:String,listener:DialogInterface.OnClickListener?):TipsDialog{
        builder?.setNegativeButton(txt,listener)
        return this
    }

    fun toShow(){
        builder?.create()?.show()
    }


}